package cn.huanzi.qch.baseadmin.travel.thotel.controller;

import cn.huanzi.qch.baseadmin.common.controller.*;
import cn.huanzi.qch.baseadmin.common.pojo.Result;
import cn.huanzi.qch.baseadmin.travel.thotel.pojo.THotelPl;
import cn.huanzi.qch.baseadmin.travel.thotel.vo.THotelPlVo;
import cn.huanzi.qch.baseadmin.travel.thotel.service.THotelPlService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

/**
 * 酒店评论管理
 */
@RestController
@RequestMapping("/hotel/pl/")
public class THotelPlController extends CommonController<THotelPlVo, THotelPl, Integer> {

    @Autowired
    private THotelPlService tHotelPlService;

    @GetMapping("index")
    public ModelAndView toHotel() {
        return new ModelAndView("travel/hotel/pl");
    }

    /**
     * 根据评论的酒店编号查询所有评论
     *
     * @param hotelId
     * @return
     */
    @GetMapping("{hotelId}")
    public Result<List<THotelPlVo>> findHotelPlByHotelId(@PathVariable("hotelId") Integer hotelId) {
        List<THotelPlVo> vos = tHotelPlService.findPlByhotelId(hotelId);
        return Result.of(vos);
    }


}
